<%@ page language ="java" import ="java.util.*" pageEncoding ="GB2312" %>
<%@ page import ="java.sql.*" %>
<%@ page import ="javax.sql.DataSource"%>
<%@ page import ="javax.naming.*" %>
<%@ page import ="com.myapp.share.*" %>
<%@ page import ="java.util.Iterator" %>

<html>
    <head>
        <title>test your datasource</title>
    </head>
    <body>
        <%
                    out.print("..........");
                    try {
                        InitialContext initCtx = new InitialContext();
                        DataSource ds = (DataSource) initCtx.lookup("java:/comp/env/jdbc/connectionPool");
                        //Connection conn = ds.getConnection();
                        String sql = "select UserPassword from userinfo where UserName='tregedie'";
                        DBConnect loginDB = new DBConnect();
                        ArrayList rslist = new ArrayList();
                        rslist = loginDB.executeQuery(ds, sql);
                        ArrayList rstemp = new ArrayList();
                        ArrayList rstemp1 = new ArrayList();
                        rstemp.add("tregedie");
                        rstemp1.add(rstemp);
                       out.println("The rslist size is:" + rslist.size());
                       String temp = "";
                       for(int i=0; i<rstemp.size(); i++)
                           temp=(String) rstemp.get(i);
                        out.print("MySQL connection pool runs perfectly!"+temp);
                        if (rstemp1.equals(rslist))
                            out.println("XXXXXXXXXXXXXXXXXX");
                        //conn.close();
                    } catch (Exception ex) {
                        out.println("failed");
                        out.print(ex.getMessage());
                    }
        %>
    </body>
</html>